﻿@model TumbaloSoft.Models.MyViewModel
@{
    Layout = "~/Views/Shared/_VentasLayout.cshtml";
    ViewBag.Title = "Registrar Cita";
}

<script>
    // increase the default animation speed to exaggerate the effect
    //$.fx.speeds._default = 4000;
    $(function () {
        $("#dialog").dialog({
            autoOpen: false,
            resizable: false,
            height: 240,
            modal: true,
            buttons: {
                "Si": function () {
                    $("#form_1").submit();
                    $(this).dialog('close');
                },

                "No": function () {
                    $(this).dialog("close");
                }
            }
        });

        $("#open").click(function () {
            $("#dialog").dialog("open");
            return false;
        });


    });
</script>

<script>
    $(function () {
        $("#datepicker").datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'dd/mm/yy',
		
        });
    });
</script>


<!-- content -->
		<div class="body2">
			<div class="main">
				<section id="content">
					<div class="wrapper">

                        <article class="col0">
						    <nav class="urbangreymenu">
							    <h3 class="headerbar">Citas</h3>
							    <ul id="subMenu">
                                    <li>
									    <h5>@Html.ActionLink("Lista de Cita", "RegistrarCitaVentas")</h5>
								    </li>								
							    </ul>
						    </nav>
					    </article>

                        <article class="col5">
                        <div>&nbsp</div>
                        </article>
						
						<!--Formulario-->
					    <article class="col1" style="width: 500px">
						    <form id="form_1" method="post" style="height: 100%">
							    <div class="pad1">
								    <h2 class="pad_bot1 pad_top1">Modificar Cita</h2>
                                    <!--DATOS DE LA PERSONA-->
                                    <h3 class="pad_bot1 pad_top1">Datos de la Persona: </h3>
                                                         
                                                                          
                                    <!--NOMBRE-->
                                    <div class="row">
                                        <table style="width: 420px">
                                            <tr>
                                                @if (Model.PersonaNatural != null)
                                                {
                                                    <td style="width: 210px"><span>Nombre:</span></td>
                                                    <td style="width: 210px">
                                                        @Html.TextBoxFor(model => model.PersonaNatural.prNombre, new {style = "background-color: #b7b3b3", disabled = "true", @class = "input"})
                                                    </td>
                                                }
                                                else
                                                {
                                                    <td style="width: 210px"><span>Razon Social:</span></td>
                                                    <td style="width: 210px">
                                                        @Html.TextBoxFor(model => model.PersonaJuridica.prRazonSocial, new { style = "background-color: #b7b3b3", disabled = "true", @class = "input" })
                                                    </td>
                                                }
                                            </tr>
                                        </table>
                                    </div>
                                    
                                    <!--EMAIL-->
                                    <div class="row">
                                        <table style="width: 420px">
                                            <tr>
                                                <td style="width: 210px"><span>Email:</span></td>
                                                <td style="width: 210px">
                                                    @if (Model.PersonaNatural != null)
                                                    {
                                                        @Html.TextBoxFor(model => model.PersonaNatural.prEmail, new { style = "background-color: #b7b3b3", disabled = "true", @class = "input" })
                                                    }
                                                    else
                                                    {
                                                        @Html.TextBoxFor(model => model.PersonaJuridica.prEmail, new { style = "background-color: #b7b3b3", disabled = "true", @class = "input" })
                                                    }
                                                </td>
                                            </tr>
                                        </table>
                                    </div>


                                    <!--TELEFONO-->
                                    <div class="row">
                                        <table style="width: 420px">
                                            <tr>
                                                <td style="width: 210px"><span>Teléfono:</span></td>
                                                <td style="width: 210px"> 
                                                    @if (Model.PersonaNatural != null)
                                                    {
                                                        @Html.TextBoxFor(model => model.PersonaNatural.prTelefono, new { style = "background-color: #b7b3b3", disabled = "true", @class = "input" })
                                                    }
                                                    else
                                                    {
                                                        @Html.TextBoxFor(model => model.PersonaJuridica.prTelefono, new { style = "background-color: #b7b3b3", disabled = "true", @class = "input" })
                                                    }                                                    
                                                </td>
                                            </tr>
                                        </table> 
                                    </div>

                                    <!--MENSAJE-->
                                    <div class="row">
                                        <table style="width: 420px">
                                            <tr>
											    <td style="width: 173px"><span>Mensaje:</span></td>
                                                <td>
                                                    @Html.TextAreaFor(model => model.Cita.prMensaje, new { style = "background-color: #b7b3b3;  width: 264px; height: 38px; margin-left: 120px; border-left-width: 0px;", disabled = "true", @class = "input" })
                                                </td>
                                            </tr>
                                        </table> 
									</div>
										
                                    <!--DATOS DE LAS CITA-->
                                    <h3 class="pad_bot1 pad_top1">Datos de la Cita Registrada: </h3>

                                    <!--LUGAR-->
                                    <div class="row_select">
                                        <table style="width:420px">
                                            <tr>
                                                <td style="width: 210px"><span>Distrito:</span></td>
                                                <td style="width: 210px">   
                                                    <select name="Cita.prDistrito.prIdDistrito" style = "background-color: #b7b3b3", disabled = "true">                                                         
                                                        @foreach (var objTipo1 in ViewBag.listaDistrito)
                                                        {
                                                            if (Model != null && Model.Cita.prDistrito.prIdDistrito == objTipo1.prIdDistrito)
                                                            {
                                                                    <option value="@objTipo1.prIdDistrito" selected="selected">@objTipo1.prNombreDistrito</option>
                                                            }
                                                            else
                                                            {
                                                                    <option value="@objTipo1.prIdDistrito">@objTipo1.prNombreDistrito</option>
                                                            }
                                                        }
                                                    </select>
                                                </td>                                              
                                            </tr>
                                        </table>                                                    
                                    </div>

                                    <!--POSIBLEFECHA-->
                                    <div class="row">
                                        <table style="width: 420px">
                                            <tr>
                                                <td style="width: 210px"><span>Posible Fecha*:</span></td>
                                                <td style="width: 210px"> 
                                                    <input class="input"  name="prFecha" value=@Model.Cita.prFecha disabled="disabled" style = "background-color: #b7b3b3"/> 
                                                    @Html.ValidationMessageFor(model => model.Cita.prFecha, null)                                                           
                                                </td> 
                                            </tr>
                                        </table>                                                
                                    </div>
                                    
                                    <!--HORA-->
                                    <div class="row_select">
                                        <table style="width:420px">
                                            <tr>
                                                <td style="width: 210px"><span>Hora:</span></td>
                                                <td style="width: 210px">   
                                                    <select name="prHora" style = "background-color: #b7b3b3", disabled = "true">  
                                                        @if (Model.Cita.prHora == 10)
                                                        {                                                                                       
                                                            <option value=10 selected="selected">10:00 AM</option>
                                                            <option value=12>11:00 AM</option>
                                                            <option value=12>12:00 PM</option>
                                                            <option value=13>1:00 PM</option>
                                                            <option value=14>2:00 PM</option>
                                                            <option value=15>3:00 PM</option>
                                                            <option value=16>4:00 PM</option>
                                                            <option value=17>5:00 PM</option>
                                                        }
                                                        else if (Model.Cita.prHora == 11)
                                                        {   
                                                            <option value=12>10:00 AM</option>
                                                            <option value=11 selected="selected">11:00 AM</option>
                                                            <option value=12>12:00 PM</option>
                                                            <option value=13>1:00 PM</option>
                                                            <option value=14>2:00 PM</option>
                                                            <option value=15>3:00 PM</option>
                                                            <option value=16>4:00 PM</option>
                                                            <option value=17>5:00 PM</option>   
                                                        }
                                                        else if (Model.Cita.prHora == 12)
                                                        {
                                                            <option value=12>10:00 AM</option>
                                                            <option value=11>11:00 AM</option>
                                                            <option value=12 selected="selected">12:00 PM</option>
                                                            <option value=13>1:00 PM</option>
                                                            <option value=14>2:00 PM</option>
                                                            <option value=15>3:00 PM</option>
                                                            <option value=16>4:00 PM</option>
                                                            <option value=17>5:00 PM</option>                                                           
                                                        }
                                                        else if (Model.Cita.prHora == 13)
                                                        {
                                                            <option value=12>10:00 AM</option>
                                                            <option value=11>11:00 AM</option>
                                                            <option value=12>12:00 PM</option>
                                                            <option value=13 selected="selected">1:00 PM</option>
                                                            <option value=14>2:00 PM</option>
                                                            <option value=15>3:00 PM</option>
                                                            <option value=16>4:00 PM</option>
                                                            <option value=17>5:00 PM</option> 
                                                        }
                                                        else if (Model.Cita.prHora == 14)
                                                        {
                                                            <option value=12>10:00 AM</option>
                                                            <option value=11>11:00 AM</option>
                                                            <option value=12>12:00 PM</option>
                                                            <option value=13>1:00 PM</option>
                                                            <option value=14 selected="selected">2:00 PM</option>
                                                            <option value=15>3:00 PM</option>
                                                            <option value=16>4:00 PM</option>
                                                            <option value=17>5:00 PM</option> 
                                                        }
                                                        else if (Model.Cita.prHora == 15)
                                                        {
                                                            <option value=12>10:00 AM</option>
                                                            <option value=11>11:00 AM</option>
                                                            <option value=12>12:00 PM</option>
                                                            <option value=13>1:00 PM</option>
                                                            <option value=14>2:00 PM</option>
                                                            <option value=15 selected="selected">3:00 PM</option>
                                                            <option value=16>4:00 PM</option>
                                                            <option value=17>5:00 PM</option> 
                                                        }
                                                        else if (Model.Cita.prHora == 16)
                                                        {
                                                            <option value=12>10:00 AM</option>
                                                            <option value=11>11:00 AM</option>
                                                            <option value=12>12:00 PM</option>
                                                            <option value=13>1:00 PM</option>
                                                            <option value=14>2:00 PM</option>
                                                            <option value=15>3:00 PM</option>
                                                            <option value=16  selected="selected">4:00 PM</option>
                                                            <option value=17>5:00 PM</option> 
                                                        }
                                                        else if (Model.Cita.prHora == 17)
                                                        {
                                                            <option value=12>10:00 AM</option>
                                                            <option value=11>11:00 AM</option>
                                                            <option value=12>12:00 PM</option>
                                                            <option value=13>1:00 PM</option>
                                                            <option value=14>2:00 PM</option>
                                                            <option value=15>3:00 PM</option>
                                                            <option value=16>4:00 PM</option>
                                                            <option value=17  selected="selected">5:00 PM</option> 
                                                        }

                                                    </select>
                                                    
                                                </td>                                              
                                            </tr>
                                        </table>                                                    
                                    </div>

                                    <!--ASIGNAR AL VENDEDOR-->
                                    <h3 class="pad_bot1 pad_top1">Asignar Vendedor: </h3>

                                    <!--HORA-->
                                    <div class="row_select">
                                        <table style="width:420px">
                                            <tr>
                                                <td style="width: 210px"><span>Hora Progamada:</span></td>
                                                <td style="width: 210px">   
                                                    <select name="hora">                                 
                                                            <option value=10>10:00 AM</option>
                                                            <option value=11>11:00 AM</option>
                                                            <option value=12>12:00 PM</option>
                                                            <option value=13>1:00 PM</option>
                                                            <option value=14>2:00 PM</option>
                                                            <option value=15>3:00 PM</option>
                                                            <option value=16>4:00 PM</option>
                                                            <option value=17>5:00 PM</option>                                                        
                                                    </select>
                                                    @Html.ValidationMessageFor(model=>model.Cita.prHora,null)                                                           
                                                </td>                                              
                                            </tr>
                                        </table>                                                    
                                    </div>


                                    <!--FECHAFINAL-->
                                    <div class="row">
                                        <table style="width: 420px">
                                            <tr>
                                                <td style="width: 210px"><span>Fecha Programada:</span></td>
                                                <td style="width: 210px">                                                      
                                                    <input class="input"  id="datepicker"  name="prFechaFinal"/> 
                                                    @Html.ValidationMessageFor(model => model.Cita.prFechaFinal, null)                                                           
                                                </td> 
                                            </tr>
                                        </table>                                                
                                    </div>

                                    <!--VENDEDOR-->

                                    <div class="row_select"">
                                        <table style="width:420px">
                                            <tr>
                                                <td style="width: 210px"><span>Vendedor:</span></td>
                                                <td style="width: 210px">   
                                                    <select name="idVendedor">
                                                        @foreach (var objTipo in ViewBag.ListaVendedores)
                                                        {                                                                          
                                                            <option value="@objTipo.prIdVendedor">@objTipo.prNombre</option>
                                                        }
                                                        
                                                    </select>
                                                </td>                                              
                                            </tr>
                                        </table>
                                    </div> 
                                                          

                                    <!--Botones everywhere-->
                                    <table style="width: 500px">
                                    <tr>
                                        <td style="width: 167px">
									    <div id="dialog" title="Modificar Cita">
                                                    <p>Esta seguro que desea guardar los datos de la cita?</p>                                                    
                                                    <!--<a href="#" id="opener"  class="button" onClick="document.getElementById('form_1').submit()">Guardar</a>-->
                                                </div>

                                                <button id="open"  class="button">Guardar</button>

                                        </td>
                                        <td style="width: 166px"><a href="#" class="button" onclick="document.getElementById('form_1').reset()">Limpiar</a></td>
                                        <td style="width: 167px"><a href="javascript:history.go(-1)" class="button" onclick="document.getElementById('form_1').cancel()">Cancelar</a></td>
                                    </tr>
                                    </table>
                                    <br>
                                    <br>
                                </div>
                            </form>
                        </article>
					</div>
					
				</section>
			</div>
		</div>
<!-- / content -->
		
		<script type="text/javascript"> Cufon.now(); </script>
    